home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 227_01 / xxhr.c < prev    next >
Text File  |  1988-02-07  |  2KB  |  102 lines

  1. /*
  2.  *    x x h r . c
  3.  *    -----------
  4.  *    Low-level driver for the Else PC - XXHR, DXHR and XXHR vector
  5.  *    graphics board.
  6.  *    Has only very little functionality and should be enhanced to use
  7.  *    all features of this boards, if you decide to use it permanently.
  8.  *
  9.  *    Written by    Rainer Gerhards
  10.  *            Petronellastr. 6
  11.  *            D-5112 Baesweiler
  12.  *            West Germany
  13.  *            Phone (49) - 2401 - 1601
  14.  */
  15. #include <stdio.h>
  16. #include <dos.h>
  17.  
  18. #define NOLLHINC
  19.  
  20. #include "xxhr.h"
  21. #include "graphics.h"
  22.  
  23. #define    COLORS        0x10        /* set fore- and background colr*/
  24. #define    AMOVE        0x80        /* absolute move        */
  25. #define    DOT        0xa2        /* write dot (pixel)        */
  26. #define    RDOT        0xa3        /* read dot (pixel)        */
  27. #define    FSCRN        0xc0        /* fill screen            */
  28.  
  29. void    initgraf(dummy)
  30. int dummy;
  31. /**
  32. * name          initgraf
  33. *
  34. * synopsis      initgraf(dummy);
  35. *               int dummy           dummy for compatibility reasons
  36. *
  37. * description   This routine initializes the graphics board.
  38. **/
  39. {
  40. union REGS regs;
  41.  
  42. regs.h.ah = FSCRN;
  43. regs.h.dl = BLACK;
  44. int86(XXHRINT, ®s, ®s);
  45. }
  46.  
  47.  
  48. getpixel(x, y)
  49. int x, y;
  50. /**
  51. * name          getpixel
  52. *
  53. * synopsis      getpixel(x, y);
  54. *               int x, y    pixel coordinate
  55. *
  56. * description   This routine reads the color of the specified pixel.
  57. *               The color is return as function return value.
  58. **/
  59. {
  60. union REGS regs;
  61.  
  62. regs.h.ah = AMOVE;
  63. regs.x.bx = x;
  64. regs.x.cx = y;
  65. int86(XXHRINT, ®s, ®s);
  66. regs.h.ah = RDOT;
  67. int86(0x10, ®s, ®s);
  68. return((int) regs.h.al);
  69. }
  70.  
  71.  
  72. void    setpixel(x, y, color)
  73. int x, y;
  74. int color;
  75. /**
  76. * name          setpixel
  77. *
  78. * synopsis      setpixel(x, y, color);
  79. *               int x, y    pixel coordinate
  80. *        int color    requested pixel color
  81. *
  82. * description   This routine writes a pixel of "color" at coordinate "x", "y".
  83. **/
  84. {
  85. union REGS regs;
  86. static int oldcolor = -1;        /* previous set color        */
  87.  
  88. regs.h.ah = AMOVE;
  89. regs.x.bx = x;
  90. regs.x.cx = y;
  91. int86(XXHRINT, ®s, ®s);
  92. if(color != oldcolor)
  93.     {
  94.     regs.h.ah = COLORS;
  95.     regs.h.dl = color;
  96.     regs.h.dh = color;
  97.     int86(0x10, ®s, ®s);
  98.     }
  99. regs.h.ah = DOT;
  100. int86(0x10, ®s, ®s);
  101. }
  102.